﻿using PlanB.ShareDove.ConferenceOrganization.BusinessLayer;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using PlanB.Core.Configuration;
using PlanB.ShareDove.ConferenceOrganization.BusinessLayer.DataLayerInterface.Entities;
using System.Collections.Generic;
using System.IO;

namespace PlanB.ShareDove.ConferenceOrganization.TestLayer.BusinessLayerTests
{


    /// <summary>
    ///This is a test class for ConferenceOrganizationBusinessProcessesTest and is intended
    ///to contain all ConferenceOrganizationBusinessProcessesTest Unit Tests
    ///</summary>
    [TestClass()]
    public class ConferenceOrganizationBusinessProcessesTest
    {


        private TestContext testContextInstance;

        private const string SP_DATA_LAYER_ASSEMBLY_PATH = @"C:\ProDev\PlanB\ShareDove\ConferenceOrganization\DataLayer\SharePointDataLayer\bin\Debug\PlanB.ShareDove.ConferenceOrganization.SharePointDataLayer.dll";
        private const string SP_DATA_LAYER_ASSEMBLY = "PlanB.ShareDove.ConferenceOrganization.SharePointDataLayer, Version=0.0.0.1, Culture=neutral, PublicKeyToken=79ea5ba3438af0bf";
        private const string SP_DATA_LAYER_CLASS = "PlanB.ShareDove.ConferenceOrganization.DataLayer.SharePointDataLayer.SharePointDataLayer";

        private const string MOCK_DATA_LAYER_ASSEMBLY_PATH = @"C:\ProDev\PlanB\ShareDove\ConferenceOrganization\DataLayer\MockDataLayer\bin\Debug\PlanB.ShareDove.ConferenceOrganization.MockDataLayer.dll";
        private const string MOCK_DATA_LAYER_ASSEMBLY = "PlanB.ShareDove.ConferenceOrganization.MockDataLayer, Version=0.0.0.1, Culture=neutral, PublicKeyToken=79ea5ba3438af0bf";
        private const string MOCK_DATA_LAYER_CLASS = "PlanB.ShareDove.ConferenceOrganization.DataLayer.MockDataLayer.MockDataLayer";


        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for GetSessionsForDay
        ///</summary>
        [TestMethod()]
        public void GetSessionsForDayTest()
        {

            System.IO.File.Copy(MOCK_DATA_LAYER_ASSEMBLY_PATH, Path.Combine(TestContext.DeploymentDirectory, Path.GetFileName(MOCK_DATA_LAYER_ASSEMBLY_PATH)));
            System.IO.File.Copy(SP_DATA_LAYER_ASSEMBLY_PATH, Path.Combine(TestContext.DeploymentDirectory, Path.GetFileName(SP_DATA_LAYER_ASSEMBLY_PATH)));

            //System.IO.File.Copy(SpDataLayerAssembly, TestContext.TestDir);

            ConfigurationInformation configuration = new ConfigurationInformation()
            {
                DataLayerImplementationAssembly = MOCK_DATA_LAYER_ASSEMBLY,
                DataLayerImplementationClassName = MOCK_DATA_LAYER_CLASS
            };
            ConferenceOrganizationBusinessProcesses target = new ConferenceOrganizationBusinessProcesses(configuration);
            DateTime day = new DateTime(2011, 10, 19); 
            IEnumerable<ConferenceSession> actual;
            actual = target.GetSessionsForDay(null, day);
            Assert.IsTrue(actual != null);
        }
    }
}
